package com.example.nio.dao;

import com.example.nio.security.dmo.SysUser;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @ResultMap("userMap")
    @Select("SELECT su.id,su.username,su.password,sr.role_code FROM `sys_user` su left join sys_user_role sur on su.id =sur.user_id left join sys_role sr on sr.id =sur.role_id where su.username = #{username}")
    SysUser getUserInfoByUsername(String username);

    @Insert("insert into sys_user(username, password, role) value(#{username}, #{password}, #{role})")
    int insertUser(SysUser user);

    @Update("update sys_user set password = #{newPwd} where username = #{username}")
    int updateUser(String username,String newPwd);
}
